<?php
/*
 * Created on 29.12.2006
 *
 */
 
/**
 * Abstract adapter class as base class for concrete adapters through different abstraction layers
 * 
 * This class defines the methods, which have to be implemented for each db
 * abstration layer to give validators uniform read access to the database.
 * The adapter is used to ensure, that a specific validator method which uses
 * the database, has to be
 * 
 */
class util_db_Adapter 
{
    
    var $dsn;
    var $tablePrefix;

    /**
     * Constructor with initialization code
     * 
     * @param string dsn Dsn for db connection
     * @param string tablePrefix Prefix to prepend to each table
     */
    function util_db_Adapter ($dsn, $tablePrefix = '')
    {
        $this->dsn = $dsn;
        $this->tablePrefix = $tablePrefix;
    }
    
    /**
     * Select rows from the db and get an array with results
     * 
     * Selects always assoc. Where is formed as an object structure to safe 
     * Adapters for ORMs from parsing sql code snippets.
     * 
     * @param string table                      Name of the table (w/o prefix)
     * @param phpinchains_util_db_Where where   Where clause as object structure
     * @param int limit                         Number of result rows to fetch
     * @return  
     */
    function select($table, $where, $limit = 0)
    {
    }
    
    /**
     * Count the result lines for a select
     * 
     * Returns one result, if groupby === false, else an array of results.
     * 
     * @param string table                      Name of the table to select from (w/o prefix)
     * @param phpinchains_util_db_Where where   Where clause as object structure
     * @param string groupby                    Comma separated list of field for group by operator 
     */
    function count($table, $where, $groupby = '')
    {
    }
    
}

?>
